#include <bits/stdc++.h>
using namespace std;

int a[100010];
int b[100010];

int main()
{
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	int n;
	cin >> n;
	int num = 0;
	int nnum = 0;
	int numx = 0;
	int numy = 0;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		if(a[i] == 1) numx++;
		if(a[i] == 2) numy++;
	}
	if(numx+numy == n)
	{
		for(int i = 1; i <= n; i++)
			if(a[i] == 2) num++;
		cout << num;
		return 0;
	}
	if(numx+numy != n && n <= 30)
	{
		for(int i = 1; i <= n; i++)
			for(int j = 1; j <= n; j++)
				if(i != j && a[i] != 0 && a[j] != 0 && b[i] == 0)
					if(a[i] > a[j]){
						a[j] = 0; b[i] = 1;}
		for(int i = 1; i <= n; i++)
			if(a[i] != 0) nnum++;
		cout << nnum;
		return 0;
	}
	return 0;
}
